<template>
  <div class="app-container">
    <el-form :inline="true" label-width="80px">
      <el-form-item label="标题">
        <el-input v-model="listQuery.bizPicTitle" />
      </el-form-item>

      <el-form-item label="启用/禁用">
        <el-select v-model="listQuery.isEnabled" placeholder="请选择状态">
          <el-option label="--" value="0" />
          <el-option label="启用" value="1" />
          <el-option label="禁用" value="2" />
        </el-select>
      </el-form-item>

      <el-form-item label="类型">
        <el-select v-model="listQuery.type" placeholder="请选择状态">
          <el-option label="--" value="0" />
          <el-option label="浮动图" value="32" />
          <el-option label="app浮动图" value="33" />
          <el-option label="vip专享图" value="34" />
          <el-option label="轮播图" value="1" />
          <el-option label="火爆活动" value="2" />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary">搜索</el-button>
      </el-form-item>
    </el-form>

    <el-table :data="list" border style="width: 100%" v-loading="listLoading">
      <el-table-column prop="bizPicTitle" label="名称" align="center">
        <template slot-scope="scope">
          <span>{{scope.row.bizPicTitle}}</span>
        </template>
      </el-table-column>

      <el-table-column prop="filePath" label="图片" align="center">
        <template slot-scope="scope">
          <span>{{scope.row.filePath}}</span>
        </template>
      </el-table-column>

      <el-table-column prop="colour" label="颜色" align="center">
        <template slot-scope="scope">
          <span>{{scope.row.colour}}</span>
        </template>
      </el-table-column>

      <el-table-column prop="typeStr" label="类型" align="center">
        <template slot-scope="scope">
          <span>{{scope.row.typeStr}}</span>
        </template>
      </el-table-column>

      <el-table-column prop="name" label="活动名称" align="center">
        <template slot-scope="scope">
          <span>{{scope.row.saleName}}</span>
        </template>
      </el-table-column>

      <el-table-column prop="name" label="操作" align="center">
        <template slot-scope="scope">
          <el-button type="text" @click="openEdit(scope.row)">修改</el-button>
          <el-button type="text" @click.native="del(scope.row.id)" style="color:red">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="listQuery.currentPage"
      :limit.sync="listQuery.showCount"
      @pagination="getList"
    />
    <adEdit ref="adEdit" />
  </div>
</template>

<script>
import apiad from "@/api/frontManage/ad";
import Pagination from "@/components/Pagination";
import {conirm} from '@/utils/index';
import adEdit from './dialogEdit'
import { connect } from 'echarts/lib/echarts';
export default {
  name: "ad",
  components:{Pagination ,adEdit},
  data() {
    return {
      list: [],
      total:0,
      listQuery: {
        currentPage: 1,
        showCount: 10,
        bizPicTitle: "",
        isEnabled: "",
        type: ""
      },
      loading:true,
    };
  },

  created() {
    this.getList();
  },

  methods: {
    getList() {
      this.listLoading=true
      let data = apiad.getStoreBizPicInfoList();
      this.list = data.list;
      this.total = data.page.totalResult
      this.listLoading=false
    },
    //删除
    del(id){
      confirm('是否删除').then (()=>{
        console.log('to delete')
      })
    },
    //编辑
    openEdit(row){
      this.$refs.adEdit.open(row)  
    },
    
  }
   
  
};
</script>

<style scoped>
</style>